package LinkedList.MyDesighList;

import LinkedList.ListNode;

public class MyDesignListTest {
    public static void main(String[] args) {
        DesignList designList=new DesignList();
        designList.addAtHead(1);
        designList.addAtTail(2);  // 在尾部插入2
        designList.addAtTail(3);  // 在尾部插入3
        designList.addAtIndex(1, 4);  // 在索引 1 处插入4
        designList.addAtIndex(0, 5);  // 在索引 0 处插入5 (头部）

        System.out.println("链表内容:");
        ListNode currentNode = designList.head.next;  // 从虚拟头节点后的第一个节点开始
        while (currentNode != null) {
            System.out.println(currentNode.val);
            currentNode = currentNode.next;
        }
    }
}
